package io.mft.commons.db.mapper;

import lombok.Data;
@Data
public class Where {
	public enum WhereType{
		like,eq
	}
	String field;
	Object value;
	WhereType type; 
	
	public String expression() {
		switch (type) {
		case eq:
			 return field+" = ?";
		case like:
			return field+" like CONCAT('%',?,'%')";
		default:
			return field+" = ?";
		}
	}

	public String getField() {
		return field;
	}

	public void setField(String field) {
		this.field = field;
	}

	public Object getValue() {
		return value;
	}

	public void setValue(Object value) {
		this.value = value;
	}

	public WhereType getType() {
		return type;
	}

	public void setType(WhereType type) {
		this.type = type;
	}
	
}
